#
# @lc app=leetcode.cn id=1732 lang=python
#
# [1732] 找到最高海拔
#

# @lc code=start
class Solution(object):
    def largestAltitude(self, gain):
        """
        :type gain: List[int]
        :rtype: int
        """
        # height = [0]
        # for g in gain:
        #     height.append(height[-1] + g)
        # return max(height)
        return max(height := [0] + [height[-1] + g for g in gain])
# @lc code=end

